/*****************************************************************************
 *
 * Copyright (c), 2004-2020,ShangHai Neotune Information Technology Co., Ltd.
 *
 * Module Name : ENVNOT~1.H
 *
 * Author :    sean
 *
 * Date :    2004-02-05
 *
 * Version :    1.00
 *
 * Description :
 *
 * Other :
 *
 * Function List:     <Main Function>
 *
 * Modification History
 * ---------------------------------------------------------------------------
 *  1: Data :      2004-02-05
 *    Author :     sean
 *    Version :    V100R001M00
 *    Modification : creation
 *
*****************************************************************************/

//#include <ntfy_chk.h>


#include "neos_vx_win.h"

#ifndef _INCenvNotifyh
#define _INCenvNotifyh

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "envNotifyIf.h"

    enum {
        snmpNotifyName_sz = 32,
        snmpNotifyTag_sz = 0,
        snmpNotifyType_sz = 4,
        snmpNotifyStorageType_sz = 4,
        snmpNotifyRowStatus_sz = 4,
        snmpNotifyFilterProfileName_sz = 32,
        snmpNotifyFilterProfileStorType_sz = 4,
        snmpNotifyFilterProfileRowStatus_sz = 4,
        snmpNotifyFilterSubtree_sz = 64,
        snmpNotifyFilterMask_sz = 255,
        snmpNotifyFilterType_sz = 4,
        snmpNotifyFilterStorageType_sz = 4,
        snmpNotifyFilterRowStatus_sz = 4
    };


#define NOTIFY_TYPE(n) (SNMP_Notify_Get_Type(n))

#define TARGET_PARAMS(t) (SNMP_Target_Addr_Get_Params(t))
#define TARGET_PARAMS_LEN(t) (SNMP_Target_Addr_Get_Params_Len(t))

#define PARAMS_LOOKUP(p,pl) (SNMP_Target_Params_Lookup(p,pl))
#define MP_MODEL(p) (SNMP_Target_Params_Get_MP_Model(p))
#define SEC_MODEL(p) (SNMP_Target_Params_Get_Sec_Model(p))
#define SEC_NAME(p) (SNMP_Target_Params_Get_Sec_Name(p))
#define SEC_NAME_LEN(p) (SNMP_Target_Params_Get_Sec_Name_Len(p))
#define SEC_LEVEL(p) (SNMP_Target_Params_Get_Sec_Level(p))

#define GROUP_LOOKUP(sm,sn,snl) (SNMP_Group_Lookup(sm,sn,snl))
#define GROUP_ID(g) (SNMP_Group_Get_Group(g))
#define GROUP_ID_LEN(g) (SNMP_Group_Get_Group_Len(g))

#define ACCESS(g,gl,c,cl,sm,sl) (SNMP_V3_Access_Find(g,gl,c,cl,sm,sl))
#define ACCESS_NOTIFY(a) (SNMP_V3_Access_Get_Notify(a))
#define ACCESS_NOTIFY_LEN(a) (SNMP_V3_Access_Get_Notify_Len(a))

    typedef struct
    {
        uchar_t     notifyName[snmpNotifyName_sz + 4]; /* used to index into notify table */
        ulong_t     trapOid [OID_PREFIX_SIZE + 1]; /* object ID of trap being set */
        ulong_t     oidLen;         /* number of sub-identifiers in object ID */
        vbList_t     *vbList;        /* list of varbinds */
    } notifyApiData_t;

    /* SNMP packet creation function prototypes */

    IMPORT SNMP_PKT_T *SNMP_EnvoyNotifyV1PacketCreate (ulong_t *, ulong_t, ulong_t,
            uchar_t *, ulong_t);
    IMPORT SNMP_PKT_T *SNMP_EnvoyNotifyV2PacketCreate (ulong_t, ulong_t, uchar_t *, ulong_t,
            ulong_t, ulong_t , ulong_t);
    IMPORT SNMP_PKT_T *SNMP_EnvoyNotifyV3PacketCreate (ulong_t, ulong_t, ulong_t,
            uchar_t, ulong_t, uchar_t *,
            ulong_t, uchar_t *, ulong_t,
            uchar_t *, ulong_t, uchar_t *,
            ulong_t, ulong_t, ulong_t,
            ulong_t, ulong_t);

    /* View manipulation function prototypes */
    IMPORT struct VIEWINDEX_S *SNMP_NotifyViewFamilyGet (viewId_t *);
    IMPORT int SNMP_NotifyViewFamilyCheck (struct VIEWINDEX_S *, OIDC_T *oidc,
                                           int, int);

    /* Target list manipulation function protoypes */


    /* OID list manipulation fuction prototypes */
    IMPORT STATUS SNMP_NotifyIDBOidCopy (OIDC_T *, OIDC_T *, OIDC_T, ulong_t);
    IMPORT STATUS SNMP_NotifyOidInstanceAdd (OIDC_T *, ulong_t, ulong_t *, ulong_t);

    /* varbind list manipulation fuction prototypes */
    IMPORT STATUS SNMP_NotifyVbListBind (VBL_T *, int, vbList_t *);
    IMPORT STATUS SNMP_NotifyVbListCopy (vbList_t *, vbList_t *);

    IMPORT STATUS SNMP_SendNotify (ulong_t version, ulong_t requestId, ulong_t type, ulong_t *trapOid, ulong_t trapOidLen,
                                   vbList_t   *vbList, SNMPADDR_T *toAddr, SNMPADDR_T *locAddr, void *cookie);
    IMPORT STATUS SNMP_NotifyVbListValidate (vbList_t   *pVbList);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _INCenvNotifyh */
